home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / TextServices.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  11.8 KB  |  357 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        TextServices.h
  3.  
  4.      Contains:    Text Services Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 8.2
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1991-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TEXTSERVICES__
  18. #define __TEXTSERVICES__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23. #ifndef __MACTYPES__
  24. #include <MacTypes.h>
  25. #endif
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29. #ifndef __MENUS__
  30. #include <Menus.h>
  31. #endif
  32. #ifndef __AEDATAMODEL__
  33. #include <AEDataModel.h>
  34. #endif
  35. #ifndef __AEREGISTRY__
  36. #include <AERegistry.h>
  37. #endif
  38. #ifndef __COMPONENTS__
  39. #include <Components.h>
  40. #endif
  41.  
  42.  
  43.  
  44. #if PRAGMA_ONCE
  45. #pragma once
  46. #endif
  47.  
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. #if PRAGMA_IMPORT
  53. #pragma import on
  54. #endif
  55.  
  56. #if PRAGMA_STRUCT_ALIGN
  57.     #pragma options align=mac68k
  58. #elif PRAGMA_STRUCT_PACKPUSH
  59.     #pragma pack(push, 2)
  60. #elif PRAGMA_STRUCT_PACK
  61.     #pragma pack(2)
  62. #endif
  63.  
  64.  
  65. enum {
  66.     kTextService                = FOUR_CHAR_CODE('tsvc'),        /* component type for the component description */
  67.     kInputMethodService            = FOUR_CHAR_CODE('inpm'),        /* component subtype for the component description */
  68.     kTSMVersion                    = 0x0150                        /* Version of the Text Services Manager is 1.5 */
  69. };
  70.  
  71.  
  72. enum {
  73.     kUnicodeDocument            = FOUR_CHAR_CODE('udoc'),        /* TSM Document type for Unicode-savvy application */
  74.     kUnicodeTextService            = FOUR_CHAR_CODE('utsv')        /* Component type for Unicode Text Service */
  75. };
  76.  
  77. /* Language and Script constants*/
  78.  
  79. enum {
  80.     kUnknownLanguage            = 0xFFFF,
  81.     kUnknownScript                = 0xFFFF,
  82.     kNeutralScript                = 0xFFFF
  83. };
  84.  
  85.  
  86.  
  87. enum {
  88.                                                                 /* Component Flags in ComponentDescription */
  89.     bTakeActiveEvent            = 15,                            /* bit set if the component takes active event */
  90.     bHandleAERecording            = 16,                            /* bit set if the component takes care of recording Apple Events <new in vers2.0> */
  91.     bScriptMask                    = 0x00007F00,                    /* bit 8 - 14 */
  92.     bLanguageMask                = 0x000000FF,                    /* bit 0 - 7  */
  93.     bScriptLanguageMask            = bScriptMask + bLanguageMask    /* bit 0 - 14  */
  94. };
  95.  
  96.  
  97. enum {
  98.                                                                 /* Typing method property constants for Input Methods */
  99.     kIMJaTypingMethodProperty    = FOUR_CHAR_CODE('jtyp'),        /* Typing method property for Japanese input methods*/
  100.     kIMJaTypingMethodRoman        = FOUR_CHAR_CODE('roma'),        /* Roman typing*/
  101.     kIMJaTypingMethodKana        = FOUR_CHAR_CODE('kana')        /* Kana typing*/
  102. };
  103.  
  104.  
  105. enum {
  106.                                                                 /* Low level routines which are dispatched directly to the Component Manager */
  107.     kCMGetScriptLangSupport        = 0x0001,                        /* Component Manager call selector 1 */
  108.     kCMInitiateTextService        = 0x0002,                        /* Component Manager call selector 2 */
  109.     kCMTerminateTextService        = 0x0003,                        /* Component Manager call selector 3 */
  110.     kCMActivateTextService        = 0x0004,                        /* Component Manager call selector 4 */
  111.     kCMDeactivateTextService    = 0x0005,                        /* Component Manager call selector 5 */
  112.     kCMTextServiceEvent            = 0x0006,                        /* Component Manager call selector 6 */
  113.     kCMGetTextServiceMenu        = 0x0007,                        /* Component Manager call selector 7 */
  114.     kCMTextServiceMenuSelect    = 0x0008,                        /* Component Manager call selector 8 */
  115.     kCMFixTextService            = 0x0009,                        /* Component Manager call selector 9 */
  116.     kCMSetTextServiceCursor        = 0x000A,                        /* Component Manager call selector 10 */
  117.     kCMHidePaletteWindows        = 0x000B,                        /* Component Manager call selector 11 */
  118.     kCMGetTextServiceProperty    = 0x000C,                        /* Component Manager call selector 12 */
  119.     kCMSetTextServiceProperty    = 0x000D                        /* Component Manager call selector 13 */
  120. };
  121.  
  122.  
  123. enum {
  124.                                                                 /* New low level routines which are dispatched directly to the Component Manager */
  125.     kCMUCTextServiceEvent        = 0x000E                        /* Component Manager call selector 14 */
  126. };
  127.  
  128.  
  129. /* extract Script/Language code from Component flag ... */
  130. #define        mGetScriptCode(cdRec)        ((ScriptCode)    ((cdRec.componentFlags & bScriptMask) >> 8))
  131. #define        mGetLanguageCode(cdRec)        ((LangCode)        cdRec.componentFlags & bLanguageMask)
  132.  
  133. /* New opaque definitions for types */
  134. typedef struct OpaqueTSMDocumentID*     TSMDocumentID;
  135. typedef OSType                             InterfaceTypeList[1];
  136.  
  137. /* Text Service Info List */
  138.  
  139. struct TextServiceInfo {
  140.     Component                         fComponent;
  141.     Str255                             fItemName;
  142. };
  143. typedef struct TextServiceInfo            TextServiceInfo;
  144. typedef TextServiceInfo *                TextServiceInfoPtr;
  145.  
  146. struct TextServiceList {
  147.     short                             fTextServiceCount;            /* number of entries in the 'fServices' array */
  148.     TextServiceInfo                 fServices[1];                /* Note: array of 'TextServiceInfo' records follows */
  149. };
  150. typedef struct TextServiceList            TextServiceList;
  151. typedef TextServiceList *                TextServiceListPtr;
  152. typedef TextServiceListPtr *            TextServiceListHandle;
  153.  
  154. struct ScriptLanguageRecord {
  155.     ScriptCode                         fScript;
  156.     LangCode                         fLanguage;
  157. };
  158. typedef struct ScriptLanguageRecord        ScriptLanguageRecord;
  159.  
  160. struct ScriptLanguageSupport {
  161.     short                             fScriptLanguageCount;        /* number of entries in the 'fScriptLanguageArray' array */
  162.     ScriptLanguageRecord             fScriptLanguageArray[1];    /* Note: array of 'ScriptLanguageRecord' records follows */
  163. };
  164. typedef struct ScriptLanguageSupport    ScriptLanguageSupport;
  165. typedef ScriptLanguageSupport *            ScriptLanguageSupportPtr;
  166. typedef ScriptLanguageSupportPtr *        ScriptLanguageSupportHandle;
  167. /* High level TSM Doucment routines */
  168. EXTERN_API( OSErr )
  169. NewTSMDocument                    (short                     numOfInterface,
  170.                                  InterfaceTypeList         supportedInterfaceTypes,
  171.                                  TSMDocumentID *        idocID,
  172.                                  long                     refcon)                                TWOWORDINLINE(0x7000, 0xAA54);
  173.  
  174. EXTERN_API( OSErr )
  175. DeleteTSMDocument                (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7001, 0xAA54);
  176.  
  177. EXTERN_API( OSErr )
  178. ActivateTSMDocument                (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7002, 0xAA54);
  179.  
  180. EXTERN_API( OSErr )
  181. DeactivateTSMDocument            (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7003, 0xAA54);
  182.  
  183. EXTERN_API( Boolean )
  184. SetTSMCursor                    (Point                     mousePos)                            TWOWORDINLINE(0x7006, 0xAA54);
  185.  
  186. EXTERN_API( OSErr )
  187. FixTSMDocument                    (TSMDocumentID             idocID)                                TWOWORDINLINE(0x7007, 0xAA54);
  188.  
  189. /* Utilities */
  190. EXTERN_API( OSErr )
  191. UseInputWindow                    (TSMDocumentID             idocID,
  192.                                  Boolean                 useWindow)                            TWOWORDINLINE(0x7010, 0xAA54);
  193.  
  194. EXTERN_API( Boolean )
  195. TSMEvent                        (EventRecord *            event)                                TWOWORDINLINE(0x7004, 0xAA54);
  196.  
  197. EXTERN_API( Boolean )
  198. TSMMenuSelect                    (long                     menuResult)                            TWOWORDINLINE(0x7005, 0xAA54);
  199.  
  200. EXTERN_API( OSErr )
  201. InitTSMAwareApplication            (void)                                                        TWOWORDINLINE(0x7014, 0xAA54);
  202.  
  203. EXTERN_API( OSErr )
  204. CloseTSMAwareApplication        (void)                                                        TWOWORDINLINE(0x7015, 0xAA54);
  205.  
  206. /* Redundant Utilities */
  207. EXTERN_API( OSErr )
  208. SendAEFromTSMComponent            (const AppleEvent *        theAppleEvent,
  209.                                  AppleEvent *            reply,
  210.                                  AESendMode             sendMode,
  211.                                  AESendPriority         sendPriority,
  212.                                  long                     timeOutInTicks,
  213.                                  AEIdleUPP                 idleProc,
  214.                                  AEFilterUPP             filterProc)                            TWOWORDINLINE(0x700B, 0xAA54);
  215.  
  216. EXTERN_API( OSErr )
  217. NewServiceWindow                (void *                    wStorage,
  218.                                  const Rect *            boundsRect,
  219.                                  ConstStr255Param         title,
  220.                                  Boolean                 visible,
  221.                                  short                     theProc,
  222.                                  WindowPtr                 behind,
  223.                                  Boolean                 goAwayFlag,
  224.                                  ComponentInstance         ts,
  225.                                  WindowPtr *            window)                                TWOWORDINLINE(0x7011, 0xAA54);
  226.  
  227. EXTERN_API( OSErr )
  228. NewCServiceWindow                (void *                    wStorage,
  229.                                  const Rect *            boundsRect,
  230.                                  ConstStr255Param         title,
  231.                                  Boolean                 visible,
  232.                                  short                     theProc,
  233.                                  WindowPtr                 behind,
  234.                                  Boolean                 goAwayFlag,
  235.                                  ComponentInstance         ts,
  236.                                  WindowPtr *            window)                                TWOWORDINLINE(0x701A, 0xAA54);
  237.  
  238. EXTERN_API( OSErr )
  239. CloseServiceWindow                (WindowPtr                 window)                                TWOWORDINLINE(0x7012, 0xAA54);
  240.  
  241. EXTERN_API( OSErr )
  242. GetFrontServiceWindow            (WindowPtr *            window)                                TWOWORDINLINE(0x7013, 0xAA54);
  243.  
  244. EXTERN_API( short )
  245. FindServiceWindow                (Point                     thePoint,
  246.                                  WindowPtr *            theWindow)                            TWOWORDINLINE(0x7017, 0xAA54);
  247.  
  248. EXTERN_API( OSErr )
  249. SetDefaultInputMethod            (Component                 ts,
  250.                                  ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700C, 0xAA54);
  251.  
  252. EXTERN_API( OSErr )
  253. GetDefaultInputMethod            (Component *            ts,
  254.                                  ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700D, 0xAA54);
  255.  
  256. EXTERN_API( OSErr )
  257. SetTextServiceLanguage            (ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700E, 0xAA54);
  258.  
  259. EXTERN_API( OSErr )
  260. GetTextServiceLanguage            (ScriptLanguageRecord *    slRecordPtr)                        TWOWORDINLINE(0x700F, 0xAA54);
  261.  
  262. /* Component Manager Interfaces to Input Methods */
  263. EXTERN_API( ComponentResult )
  264. GetScriptLanguageSupport        (ComponentInstance         ts,
  265.                                  ScriptLanguageSupportHandle * scriptHdl)                    FIVEWORDINLINE(0x2F3C, 0x0004, 0x0001, 0x7000, 0xA82A);
  266.  
  267. EXTERN_API( ComponentResult )
  268. InitiateTextService                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0002, 0x7000, 0xA82A);
  269.  
  270. EXTERN_API( ComponentResult )
  271. TerminateTextService            (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0003, 0x7000, 0xA82A);
  272.  
  273. EXTERN_API( ComponentResult )
  274. ActivateTextService                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0004, 0x7000, 0xA82A);
  275.  
  276. EXTERN_API( ComponentResult )
  277. DeactivateTextService            (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0005, 0x7000, 0xA82A);
  278.  
  279. EXTERN_API( ComponentResult )
  280. TextServiceEvent                (ComponentInstance         ts,
  281.                                  short                     numOfEvents,
  282.                                  EventRecord *            event)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0006, 0x7000, 0xA82A);
  283.  
  284. EXTERN_API( ComponentResult )
  285. UCTextServiceEvent                (ComponentInstance         ts,
  286.                                  short                     numOfEvents,
  287.                                  EventRecord *            event,
  288.                                  UniChar                 unicodeString[],
  289.                                  UniCharCount             unicodeStrLength)                    FIVEWORDINLINE(0x2F3C, 0x000E, 0x000E, 0x7000, 0xA82A);
  290.  
  291. EXTERN_API( ComponentResult )
  292. GetTextServiceMenu                (ComponentInstance         ts,
  293.                                  MenuHandle *            serviceMenu)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x0007, 0x7000, 0xA82A);
  294.  
  295. EXTERN_API( ComponentResult )
  296. TextServiceMenuSelect            (ComponentInstance         ts,
  297.                                  MenuHandle             serviceMenu,
  298.                                  short                     item)                                FIVEWORDINLINE(0x2F3C, 0x0006, 0x0008, 0x7000, 0xA82A);
  299.  
  300. EXTERN_API( ComponentResult )
  301. FixTextService                    (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x0009, 0x7000, 0xA82A);
  302.  
  303. EXTERN_API( ComponentResult )
  304. SetTextServiceCursor            (ComponentInstance         ts,
  305.                                  Point                     mousePos)                            FIVEWORDINLINE(0x2F3C, 0x0004, 0x000A, 0x7000, 0xA82A);
  306.  
  307. EXTERN_API( ComponentResult )
  308. HidePaletteWindows                (ComponentInstance         ts)                                    FIVEWORDINLINE(0x2F3C, 0x0000, 0x000B, 0x7000, 0xA82A);
  309.  
  310. EXTERN_API( OSErr )
  311. GetServiceList                    (short                     numOfInterface,
  312.                                  OSType *                supportedInterfaceTypes,
  313.                                  TextServiceListHandle * serviceInfo,
  314.                                  long *                    seedValue)                            TWOWORDINLINE(0x7008, 0xAA54);
  315.  
  316. EXTERN_API( OSErr )
  317. OpenTextService                    (TSMDocumentID             idocID,
  318.                                  Component                 aComponent,
  319.                                  ComponentInstance *    aComponentInstance)                    TWOWORDINLINE(0x7009, 0xAA54);
  320.  
  321. EXTERN_API( OSErr )
  322. CloseTextService                (TSMDocumentID             idocID,
  323.                                  ComponentInstance         aComponentInstance)                    TWOWORDINLINE(0x700A, 0xAA54);
  324.  
  325. EXTERN_API( ComponentResult )
  326. GetTextServiceProperty            (ComponentInstance         ts,
  327.                                  OSType                 propertySelector,
  328.                                  SInt32 *                result)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000C, 0x7000, 0xA82A);
  329.  
  330. EXTERN_API( ComponentResult )
  331. SetTextServiceProperty            (ComponentInstance         ts,
  332.                                  OSType                 propertySelector,
  333.                                  SInt32                 value)                                FIVEWORDINLINE(0x2F3C, 0x0008, 0x000D, 0x7000, 0xA82A);
  334.  
  335.  
  336.  
  337. #if PRAGMA_STRUCT_ALIGN
  338.     #pragma options align=reset
  339. #elif PRAGMA_STRUCT_PACKPUSH
  340.     #pragma pack(pop)
  341. #elif PRAGMA_STRUCT_PACK
  342.     #pragma pack()
  343. #endif
  344.  
  345. #ifdef PRAGMA_IMPORT_OFF
  346. #pragma import off
  347. #elif PRAGMA_IMPORT
  348. #pragma import reset
  349. #endif
  350.  
  351. #ifdef __cplusplus
  352. }
  353. #endif
  354.  
  355. #endif /* __TEXTSERVICES__ */
  356.  
  357.